from selenium import webdriver
from selenium.webdriver.common.by import By
import time

path = 'msedgedriver.exe'
browser = webdriver.Edge(path)
browser.maximize_window()

browser.get('https://www.baidu.com')
time.sleep(3)
input=browser.find_element(By.ID,'kw')
input.send_keys('萌娘百科')
button=browser.find_element(By.ID,'su')
button.click()
time.sleep(3)
for i in range(10,200):
    browser.execute_script("document.documentElement.scrollTop=10000")
    str='//*[@id="page"]/div/a[10]'
    if i>10:
        str='//*[@id="page"]/div/a[11]'
    next = browser.find_element(By.XPATH, str)
    time.sleep(1)
    next.click()
    time.sleep(3)
